/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mainform;

public class Card {

	public static int getPoint(int arg0) {
		if(Card.isHeart(arg0)) return 1;
		if(arg0 == 10) return 13;
		return 0;
	}

	/**
	 * @return 0 when arg1 equal arg2, 1 when arg1 > arg2, -1 when arg1 < arg2
	 * and -2 when not same suit
	 */
	public static int compare(int arg1, int arg2) {
		if(!Card.isSameType(arg1, arg2)) return -2;
		if(arg1 > arg2) return 1;
		if(arg1 < arg2) return -1;
		return 0;
	}

	public static boolean isSameType(int arg1, int arg2) {
		if(Card.isSpade(arg1) && Card.isSpade(arg2))
			return true;
		if(Card.isClub(arg1) && Card.isClub(arg2))
			return true;
		if(Card.isDiamond(arg1) && Card.isDiamond(arg2))
			return true;
		if(Card.isHeart(arg1) && Card.isHeart(arg2))
			return true;
		return false;
	}

	public static boolean isSpade(int value) {
		if(value >= 0 && value <= 12)
			return true;
		return false;
	}

	public static boolean isClub(int value) {
		if(value >= 13 && value <= 25)
			return true;
		return false;
	}

	public static boolean isDiamond(int value) {
		if(value >= 26 && value <= 38)
			return true;
		return false;
	}

	public static boolean isHeart(int value) {
		if(value >= 39 && value <= 51)
			return true;
		return false;
	}
}
